package com.market.category.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.market.category.dao.CategoryDao;

@Controller
public class CateDeleteController {
	@Autowired
	private CategoryDao categoryDao;
	
	@RequestMapping("/categoryDelete.do")
	public String deleteProcess(@RequestParam("c_code") int c_code,
			 @RequestParam("pageNum") int pageNum,
			 @RequestParam("searchMarket") String keyWord){
		
		categoryDao.delete(c_code);
		/* 현재 테이블의 PK를 참조하는
		 * 테이블 삭제가 선행되게끔 해야 해
		 */		
		return "redirect:/categoryList.do?pageNum="+pageNum+"&searchMarket="+keyWord;
	}
}
